package com.codeZ.MementoPattern.basic;

/**
 * 客户端
 *
 * @author codeZhang
 * @Date 2024/8/30 11:36
 */
public class client {

    public static void main(String[] args) {
        Originator originator = new Originator();
        Caretaker caretaker = new Caretaker();
        originator.setState("State #1");
        originator.setState("State #2");
        caretaker.setMemento(originator.createMemento());
        originator.setState("State #3");
        caretaker.setMemento(originator.createMemento());
        originator.setState("State #4");
        System.out.println("Current State: " + originator.getState());
        originator.restoreMemento(caretaker.getMemento());
        System.out.println("Current State: " + originator.getState());
    }

}
